package com.hymjweb.demo.hymj.flight_manage.bean;

import com.hymjweb.demo.framework.util.DateUtil;
import com.hymjweb.demo.framework.util.pojoContrast.FieldMeta;
import lombok.Data;

import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

@Table(name = "b_flight")
@Data
public class BFlightPojo implements Serializable{

    @FieldMeta(columnname = "id", name = "ID")
    private String id;

    @FieldMeta(columnname = "city_id", name = "目的城市ID",comment = "关联xt_city.id")
    private String cityId;

    @FieldMeta(columnname = "airport_id", name = "始发机场ID",comment = "关联xt_airport.id")
    private String airportId;

    @FieldMeta(columnname = "airlines_id", name = "航空公司ID",comment = "关联xt_airlines.id")
    private String airlinesId;

    @FieldMeta(columnname = "flight_no", name = "航班班次号")
    private String flightNo;

    @FieldMeta(columnname = "flight_date", name = "航班日期")
    private Date flightDate;

    @FieldMeta(columnname = "plan_take_off_time", name = "计划起飞时间",comment = "格式为HH:MM(24小时制)")
    private String planTakeOffTime;

    @FieldMeta(columnname = "model", name = "机型")
    private String model;

    @FieldMeta(columnname = "comment", name = "备注")
    private String comment;

    @FieldMeta(columnname = "create_time", name = "创建时间")
    private Date createTime;

    @FieldMeta(columnname = "create_user_id", name = "记录添加人ID", comment = "关联XT_USER.ID")
    private String createUserId;

    @FieldMeta(columnname = "update_time", name = "更新时间")
    private Date updateTime;

    @FieldMeta(columnname = "update_user_id", name = "更新用户ID", comment = "关联XT_USER.ID")
    private String updateUserId;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        BFlightPojo that = (BFlightPojo) o;
        return cityId.equals(that.cityId) && airportId.equals(that.airportId) && airlinesId.equals(that.airlinesId) && flightNo.equals(that.flightNo) && DateUtil.dateToStr_yyyy_MM_dd(flightDate).equals(DateUtil.dateToStr_yyyy_MM_dd(that.flightDate));
    }

    @Override
    public int hashCode() {
        return Objects.hash(cityId, airportId, airlinesId, flightNo, flightDate);
    }
}
